/*
 * author      : dormi330 
 * date        : 2018/7/19
 * description : TODO
 */

package com.deep.trade.common;

public abstract class BaseEvent extends BaseDto {
    protected String uuid;
    protected String type;
    protected BaseDto body;

    public BaseEvent(String uuid, String type, BaseDto body) {
        this.uuid = uuid;
        this.type = type;
        this.body = body;
    }

    public BaseEvent(String type, BaseDto body) {
        this(CommonUtils.uuid(), type, body);
    }

    public BaseEvent() {
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public BaseDto getBody() {
        return body;
    }

    public void setBody(BaseDto body) {
        this.body = body;
    }

    public BaseMssage toMessage() {
        return BaseMssage.fromObject(body);
        // return new BaseMssage(uuid, body.getClass().getCanonicalName(), body.uglyString());
    }
}
